﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Practices.EnterpriseLibrary.Data;
using Enterprise.DataFactory;
using Enterprise.Model.Permission;
using Enterprise.Infrastructure;
namespace Enterprise.Data.Permission
{
    /// <summary>
    ///  权限按钮组操作
    /// </summary>
    public class PermissionGroupData
    {
        /// <summary>
        ///  权限按钮组数据列表
        /// </summary>
        /// <returns></returns>
        public List<PermissionGroupEntity> PermissionGroupList()
        {
            List<PermissionGroupEntity> list = new List<PermissionGroupEntity>();
            string cmd = "Select * from SYS_PERMISSIONGROUP";
            IDataReader dr = DbExecute.DataReader(cmd);
            while (dr.Read())
            {
                PermissionGroupEntity entity = new PermissionGroupEntity();
                if (!Convert.IsDBNull(dr["PBGROUP"])) entity.PBGROUP = Convert.ToString(dr["PBGROUP"]);
                list.Add(entity);
            }
            dr.Close();
            return list;
        }

        /// <summary>
        /// 权限按钮组数据操作方法
        /// </summary>
        /// <param name="cmd"></param>
        public void PermissionGroupExecute(string cmd)
        {
            DbExecute.Execute(cmd);
        }

    }
}
